package com.lwd.util;

import lombok.extern.slf4j.Slf4j;

import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;

/**
 * @author devil
 * @date 2019/2/18
 */
@Slf4j
public class WebUtil {

    public static void writeToResponse(HttpServletResponse resp, String msg) {
        PrintWriter pw = null;
        try {
            pw = resp.getWriter();
            pw.write(msg);
            pw.flush();
        } catch (Exception e) {
            log.error("writeToResponse exception: ", e);
        } finally {
            if (null != pw) {
                pw.close();
            }
        }
    }
}
